#ifndef _REMOUTE_CONTROLER_JNI_H_
#define _REMOUTE_CONTROLER_JNI_H_
/*----------------------------------------------------------------------
|   includes
+---------------------------------------------------------------------*/
#include "PltMediaServer.h"
#include "PltSyncMediaBrowser.h"
#include "PltRemouteControler.h"
#include "NptMap.h"
#include "NptStack.h"

#define SUCCESS_STRING "Success"
#define FAILURE_STRING "Failure"
/*----------------------------------------------------------------------
 |   PLT_SkRemouteControler
 +---------------------------------------------------------------------*/
class PLT_SkRemouteControler : public PLT_RemouteControler,
                                 public PLT_RemouteControlerDelegate
{
public:
    PLT_SkRemouteControler(PLT_CtrlPointReference& ctrlPoint);
    virtual ~PLT_SkRemouteControler();

	// PLT_RemouteControlerDelegate methods	
    bool OnRCSAdded(PLT_DeviceDataReference&  device );
    void OnRCSRemoved(PLT_DeviceDataReference&  device );
    void OnRCSStateVariablesChanged(PLT_Service*  service , 
                                           NPT_List<PLT_StateVariable*>* vars );

    // RemouteControlServer
    void OnGetDeviceInputTypesResult(
        NPT_Result                res , 
        PLT_DeviceDataReference&  device ,
        PLT_DeviceInputTypes*     typeinfos , 
        void*                     userdata );
	void OnGetTouchScreenBoundaryResult(
        NPT_Result                res ,
        PLT_DeviceDataReference&  device ,
        const char*               boundary,
        void*                     userdata);
	void OnCmdRequestResult(
        NPT_Result                res ,
        PLT_DeviceDataReference&  device ,
        const char* 			curcmd,
        const char*               cmdresult,
        void*                     userdata);
	void OnSetTouchEventResult(
        NPT_Result                res ,
        PLT_DeviceDataReference&  device ,
        void*                    userdata);

	////////////////////////////////////////////
	void removeRCSByUUID(const char * uuid);
	
	////////////////////////////////////////////
	//extern interface 
	NPT_String getAllRCS();
	NPT_String setCurRCS(const char * uuid,int num);

	NPT_String setDeviceInputStates(const char * states);
	NPT_String setTouchScreenEvent(const char * eventdata);
	void 	   tryGetTouchScreenBoundary();
	NPT_String cmdRequest(const char * cmd,const char * param);
	
private:
	PLT_DeviceDataReference ChooseControlServer(const NPT_Lock<PLT_DeviceMap>& deviceList,const char * uuid);
	
	void GetCurRCS(PLT_DeviceDataReference& rcsserver);
	
private:
	NPT_Lock<PLT_DeviceMap> m_RCSMap;
	
	PLT_DeviceDataReference m_CurRCS;
	NPT_Mutex               m_CurRCSLock;
};
PLT_SkRemouteControler* getMediaRemoteControler();
void PltRemouteControlerInit();
void PltRemouteControlerStop();
#endif

